#include "Connection.h"
#include <QApplication>
#include "DebugTool.h"
#include "Welcome.h"

#include <QShortcut>
#include <QDesktopServices>

int main(int argc, char *argv[])
{
  QApplication a(argc, argv);

  QString fileName = "StyleSheets.qss";
  loadQssFile(fileName);
  watchQssFile(fileName);

  a.setApplicationName("图书馆系统");
  qDb->setDataBase();

  Welcome w;
  QShortcut sc(QKeySequence("ctrl+q"), &w);
  QObject::connect(&sc, &QShortcut::activated, [fileName] {
    static int flag = 0;
    if (flag == 0) {
      QFileInfo info(fileName);
      QDesktopServices::openUrl(QUrl::fromLocalFile(info.absoluteFilePath()));
    }
  });

  w.show();
  return a.exec();
}
